<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
	contentType="text/html;charset=utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />

	</head>
	<body style="">
		<div class="head_content" id="headBar" style=""></div>
		<div class="main_content" id="main">
			<form enctype="multipart/form-data" method="post"
				action="<c:url value="auto_save.do"/> " id="brandForm">
				<input type="hidden" value="${auto.autoId}" name="auto.autoId" />
				<input type="hidden" value="${auto.defaultPic}" name="auto.defaultPic" />
				<input type="hidden" value="${auto.smallPic}" name="auto.smallPic" />
				<input type="hidden" name="auto.catId" value="0"  />
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									<fmt:message key="gd_brand.name" />
								</th>
								<td>
									<input type="text" value="${auto.name}" style="width: 120px;"
										name="auto.name" id="brandName" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									是否上架销售：
								</th>
								<td>
									<input type="radio" value="true"
										<c:if test="${auto.marketOn }">checked="checked"</c:if>
										name="auto.marketOn" />
									是
									<input type="radio" value="false"
										<c:if test="${!auto.marketOn }">checked="checked"</c:if>
										name="auto.marketOn" />
									否
								</td>
							</tr>
							<tr>
								<th>
									引擎
								</th>
								<td>
									<input type="text" name="auto.engine" value="${auto.engine}"
										style="width: 120px;" id="showOrder" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									变速箱
								</th>
								<td>
									<input type="text" name="auto.gearbox" value="${auto.gearbox}"
										style="width: 120px;" id="gearbox" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									品牌
								</th>
								<td>
									<select name="auto.brandId" class="x-input-select  inputstyle">

										<c:forEach var="list" items="${autoBrands}"
											varStatus="status1">
											<option
												<c:if test="${auto.brandId eq list.brandId }">selected="selected"</c:if>
												value="${list.brandId }"> ${list.brandName }
											</option>
										</c:forEach>
									</select>
								</td>
							</tr> 
							<tr>
								<th>
									所在地
								</th>
								<td>
									<input type="text" name="auto.placeId" value="${auto.placeId}"
										style="width: 120px;" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									所属商家
								</th>
								<td>
									<input type="text" name="auto.whoIs" value="${auto.whoIs}"
										style="width: 120px;" class="x-input " />
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									周一至周五价格
								</th>
								<td>
									<input type="text" value="${auto.price}" style="width: 120px;"
										name="auto.price" id="price" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									周末价格
								</th>
								<td>
									<input type="text" name="auto.weekendPrice"
										value="${auto.weekendPrice}" style="width: 120px;"
										id="weekendPrice" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									节假日价格
								</th>
								<td>
									<input type="text" name="auto.holidayPrice"
										value="${auto.holidayPrice}" style="width: 120px;"
										id="holidayPrice" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									保险费用
								</th>
								<td>
									<input type="text" name="insure" value="${auto.insure}"
										style="width: 120px;" id="insure" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									金卡
								</th>
								<td>
									<input type="text" name="auto.levelOnePrice"
										value="${auto.levelOnePrice}" style="width: 120px;"
										id="levelOnePrice" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									银卡
								</th>
								<td>
									<input type="text" name="auto.levelTwoPrice"
										value="${auto.levelTwoPrice}" style="width: 120px;"
										id="levelTwoPrice" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									铜卡
								</th>
								<td>
									<input type="text" name="auto.levelThreePrice"
										value="${auto.levelThreePrice}" style="width: 120px;"
										id="levelThreePrice" class="x-input " />
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>

							<tr>
								<th>
									图片
								</th>
								<td>
									<input type="file" name="file" class="x-input " />
								</td>
							</tr>
							<c:if test="${not empty auto.autoId}">

								<tr>
									<th>

									</th>
									<td>
										<img src="<c:url value="${auto.defaultPic}"/>" width="132px" height="132px" />
									</td>
								</tr>
							</c:if>
						</tbody>
					</table>
				</div>


				<div class="table-action">
					<button class="btn" type="submit">
						<span><span><fmt:message key="button.save" /> </span> </span>
					</button>
				</div>
			</form>
		</div>
		<div class="foot_content" id="footBar" style="font-size: 0px;"></div>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.validate.js'/>"></script>
			<%@ include file="/jsp/admin/common/messages.jsp"%>
		<script type="text/javascript">	
   
	
	

$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#brandForm").validate({
		errorElement: "div" ,
		errorClass: "x-vali-error",
		onfocusout: false,
		rules: {
			'goodsBrand.brandName' : "required",			 
			'goodsBrand.showOrder' : {
				required: true,
				number:true
			},
			'goodsBrand.brandUrl' : {
				required: true
			},
			upload : {
				required: true
			}
		},
		messages: {
			'goodsBrand.brandName': '<fmt:message key="form_validate.required" />',			 
			'goodsBrand.showOrder': '<fmt:message key="form_validate.number" />',
			'goodsBrand.brandUrl': '<fmt:message key="form_validate.required" />',
			upload: '<fmt:message key="form_validate.required" />'
		},
		 
		errorPlacement: function(error, element) {
			element.removeClass('x-vali-error');
			error.appendTo( element.parent());
			
			
		}, 
		success: function(div) {	 
			$(div).remove();
		}
	});
});




</script>
	</body>
</html>